package com.hoshiicloud.saleorder.feign;

import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.payment.Paylist;
import com.hoshiicloud.payment.param.RefundRequest;
import com.hoshiicloud.saleorder.dto.PayResultDTO;
import com.hoshiicloud.saleorder.param.PayRequestParam;
import com.hoshiicloud.saleorder.feign.hystrix.HystrixPaymentFeignFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author zhangshuhu
 * @title: paymentService
 * @projectName hoshiicloud
 * @description: 支付服务
 * @since 2019-06-01
 */
@FeignClient(name = "hoshiicloud-payment", fallback = HystrixPaymentFeignFallback.class)
public interface PaymentService {

    /**
     * 订单支付
     *
     * @param payRequestParam
     * @return
     */
    @RequestMapping(value = "/pay/order", method = {RequestMethod.POST})
    Response<PayResultDTO> order(@RequestBody PayRequestParam payRequestParam);

    /**
     * 订单退款
     *
     * @param refundRequest
     * @return
     */
    @RequestMapping(value = "/pay/refund", method = {RequestMethod.POST})
    Response<Paylist> refundOrder(@RequestBody RefundRequest refundRequest);
}
